﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleSurvival.src
{
    //-----------------------------------------------//
    //CLASS - EntityFactory.cs
    //-----------------------------------------------//
    public class EntityFactory
    {
        //Next iteration isolate entityDefinitions into this class
        EntityDefinitions _entityDefinitions = null;
        EntityDrawer _entityDrawer = null;
        Map _map = null;

        //Creates a unit
        public IUnit MakeUnit(string name, SwinGame.Vector pos)
        {
            return new Unit(name,pos, _map,_entityDrawer,_entityDefinitions);
        }

        //Creates a terrain tile
        public ITerrainTile MakeTerrainTile(int x, int y,string name)
        {
            return new TerrainTile(x,y,name,_map,_entityDrawer,_entityDefinitions);
        }

        //Creates a Damage Projectile
        public IDamagePacket MakeDamagePacket(DamagePacketType packetType,
            ObjectController<IEntity> controller,int damage,IEntity owner,int life)
        {
            return new DamagePacket(packetType, controller, damage, owner,
                                    life, _map, _entityDrawer, _entityDefinitions);
        }
        
        //Set references
        public EntityFactory(EntityDefinitions defs, EntityDrawer ed, Map map)
        {
            _entityDefinitions = defs;
            _entityDrawer = ed;
            _map = map;
        }
    }
}
